-- Create table
create table ORDER_MGMT
(
  order_mgmt_objid NUMBER not null,
  region_cd        VARCHAR2(15),
  customer_cd      VARCHAR2(15),
  order_title      VARCHAR2(200),
  order_cd         VARCHAR2(15),
  del_date         VARCHAR2(8),
  plant_cd         VARCHAR2(15),
  req_date         VARCHAR2(8),
  reason           VARCHAR2(4000),
  result_cd        VARCHAR2(15),
  project_no       VARCHAR2(50),
  order_price      VARCHAR2(20),
  design_pm        VARCHAR2(20),
  production_pm    VARCHAR2(20),
  electro_pm       VARCHAR2(20),
  se_pm            VARCHAR2(20),
  manager_pm       VARCHAR2(20),
  reg_id           VARCHAR2(20),
  reg_date         DATE
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Add comments to the table 
comment on table ORDER_MGMT
  is '영업활동등록';
-- Add comments to the columns 
comment on column ORDER_MGMT.order_mgmt_objid
  is '영업활동등록OBJID';
comment on column ORDER_MGMT.region_cd
  is '지역';
comment on column ORDER_MGMT.customer_cd
  is '고객사';
comment on column ORDER_MGMT.order_title
  is '수주명';
comment on column ORDER_MGMT.order_cd
  is '수주ITEM코드';
comment on column ORDER_MGMT.del_date
  is '납기일';
comment on column ORDER_MGMT.plant_cd
  is '공장코드';
comment on column ORDER_MGMT.req_date
  is '견적요청일';
comment on column ORDER_MGMT.reason
  is '특이사항';
comment on column ORDER_MGMT.result_cd
  is '수주결과';
comment on column ORDER_MGMT.project_no
  is '프로젝트NO';
comment on column ORDER_MGMT.order_price
  is '수주가(억원)';
comment on column ORDER_MGMT.design_pm
  is '설계_PM';
comment on column ORDER_MGMT.production_pm
  is '생산_PM';
comment on column ORDER_MGMT.electro_pm
  is '전장_PM';
comment on column ORDER_MGMT.se_pm
  is 'SE_PM';
comment on column ORDER_MGMT.manager_pm
  is '설계총괄PM';
comment on column ORDER_MGMT.reg_id
  is '등록자';
comment on column ORDER_MGMT.reg_date
  is '등록일';
-- Create/Recreate primary, unique and foreign key constraints 
alter table ORDER_MGMT
  add constraint ORDER_MGMT_PK primary key (ORDER_MGMT_OBJID)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );


-- Create table
create table PROJECT_MGMT
(
  project_mgmt_objid NUMBER not null,
  order_mgmt_objid   NUMBER not null,
  region_cd          VARCHAR2(15),
  customer_cd        VARCHAR2(15),
  order_cd           VARCHAR2(15),
  project_title      VARCHAR2(200),
  del_date           VARCHAR2(8),
  plant_cd           VARCHAR2(15),
  manager_pm         VARCHAR2(20),
  reg_id             VARCHAR2(20),
  reg_date           DATE
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Add comments to the table 
comment on table PROJECT_MGMT
  is '프로젝트진행현황';
-- Add comments to the columns 
comment on column PROJECT_MGMT.project_mgmt_objid
  is '프로젝트OBJID';
comment on column PROJECT_MGMT.order_mgmt_objid
  is '영업등록OBJID';
comment on column PROJECT_MGMT.region_cd
  is '지역';
comment on column PROJECT_MGMT.customer_cd
  is '고객사';
comment on column PROJECT_MGMT.order_cd
  is '수주ITEM코드';
comment on column PROJECT_MGMT.project_title
  is '프로젝트TITLE';
comment on column PROJECT_MGMT.del_date
  is '납기일';
comment on column PROJECT_MGMT.plant_cd
  is '공장코드';
comment on column PROJECT_MGMT.manager_pm
  is '설계총괄PM';
comment on column PROJECT_MGMT.reg_id
  is '등록자';
comment on column PROJECT_MGMT.reg_date
  is '등록일';
-- Create/Recreate primary, unique and foreign key constraints 
alter table PROJECT_MGMT
  add constraint PROJECT_MGMT_PK primary key (PROJECT_MGMT_OBJID)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );


-- Create table
create table PART_MGMT
(
  part_mgmt_objid        NUMBER not null,
  part_mgmt_parent_objid NUMBER,
  project_mgmt_objid     NUMBER not null,
  part_level             VARCHAR2(10),
  part_name              VARCHAR2(100),
  part_no                VARCHAR2(100) not null,
  parent_part_no         VARCHAR2(100),
  spec_cd                VARCHAR2(100),
  mfa_cd                 VARCHAR2(100),
  qty                    VARCHAR2(10),
  process_cd             VARCHAR2(100),
  sort_cd                VARCHAR2(100),
  sup_cd                 VARCHAR2(100),
  rev                    VARCHAR2(10) not null,
  rel_date               DATE,
  reg_date               DATE,
  reg_user_id            VARCHAR2(20)
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Add comments to the table 
comment on table PART_MGMT
  is '설계관리';
-- Add comments to the columns 
comment on column PART_MGMT.part_mgmt_objid
  is 'OBJID';
comment on column PART_MGMT.project_mgmt_objid
  is 'PROJECT_OBJID';
comment on column PART_MGMT.part_level
  is 'PART LEVEL';
comment on column PART_MGMT.part_name
  is '품목명';
comment on column PART_MGMT.part_no
  is '품번';
comment on column PART_MGMT.parent_part_no
  is '모품';
comment on column PART_MGMT.spec_cd
  is '규격';
comment on column PART_MGMT.mfa_cd
  is '제조사';
comment on column PART_MGMT.qty
  is '수량';
comment on column PART_MGMT.process_cd
  is '후처리';
comment on column PART_MGMT.sort_cd
  is '부품구분';
comment on column PART_MGMT.sup_cd
  is '공급업체';
comment on column PART_MGMT.rev
  is '리비전';
comment on column PART_MGMT.rel_date
  is '배포일';
comment on column PART_MGMT.reg_date
  is '등록일';
comment on column PART_MGMT.reg_user_id
  is '등록';
-- Create/Recreate primary, unique and foreign key constraints 
alter table PART_MGMT
  add constraint PART_NO_PK primary key (PART_NO, REV)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );



-- Create table
create table MATERIAL_MGMT
(
  material_mgmt_objid NUMBER not null,
  project_mgmt_objid  NUMBER not null,
  part_level          VARCHAR2(10),
  part_name           VARCHAR2(100),
  part_no             VARCHAR2(100) not null,
  spec_cd             VARCHAR2(100),
  mfa_cd              VARCHAR2(100),
  qty                 VARCHAR2(10),
  process_cd          VARCHAR2(100),
  sort_cd             VARCHAR2(100),
  sup_cd              VARCHAR2(100),
  rev                 VARCHAR2(10) not null,
  rel_date            DATE,
  unit_price          VARCHAR2(20),
  supply_amount       VARCHAR2(20),
  req_date            VARCHAR2(10),
  rec_date            VARCHAR2(10),
  receive_qty         VARCHAR2(10),
  acq_user_id         VARCHAR2(20),
  acq_date            VARCHAR2(10),
  acq_qty             VARCHAR2(10),
  cur_user_id         VARCHAR2(20),
  status_cd           VARCHAR2(20),
  reg_date            DATE,
  reg_user_id         VARCHAR2(20)
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Add comments to the table 
comment on table MATERIAL_MGMT
  is '자재관리(발주관리)';
-- Add comments to the columns 
comment on column MATERIAL_MGMT.material_mgmt_objid
  is 'OBJID';
comment on column MATERIAL_MGMT.project_mgmt_objid
  is 'PROJECT_OBJID';
comment on column MATERIAL_MGMT.part_level
  is 'PART LEVEL';
comment on column MATERIAL_MGMT.part_name
  is '품목명';
comment on column MATERIAL_MGMT.part_no
  is '품번';
comment on column MATERIAL_MGMT.spec_cd
  is '규격';
comment on column MATERIAL_MGMT.mfa_cd
  is '제조사';
comment on column MATERIAL_MGMT.qty
  is '수량';
comment on column MATERIAL_MGMT.process_cd
  is '후처리';
comment on column MATERIAL_MGMT.sort_cd
  is '부품구분';
comment on column MATERIAL_MGMT.sup_cd
  is '공급업체';
comment on column MATERIAL_MGMT.rev
  is '리비전';
comment on column MATERIAL_MGMT.rel_date
  is '배포일';
comment on column MATERIAL_MGMT.unit_price
  is '단가';
comment on column MATERIAL_MGMT.supply_amount
  is '공급금랙';
comment on column MATERIAL_MGMT.req_date
  is '입고요청일';
comment on column MATERIAL_MGMT.rec_date
  is '입고일';
comment on column MATERIAL_MGMT.receive_qty
  is '입고수량';
comment on column MATERIAL_MGMT.acq_user_id
  is '인수자';
comment on column MATERIAL_MGMT.acq_date
  is '인수일';
comment on column MATERIAL_MGMT.acq_qty
  is '인수수량';
comment on column MATERIAL_MGMT.cur_user_id
  is '현재처리자';
comment on column MATERIAL_MGMT.status_cd
  is '상태';
comment on column MATERIAL_MGMT.reg_date
  is '등록일';
comment on column MATERIAL_MGMT.reg_user_id
  is '등록';
-- Create/Recreate primary, unique and foreign key constraints 
alter table MATERIAL_MGMT
  add constraint MATERIAL_MGMT_PK primary key (PROJECT_MGMT_OBJID, PART_NO, REV)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );


-- Create table
create table INVENTORY_MGMT
(
  inventory_mgmt_objid NUMBER not null,
  project_mgmt_objid   NUMBER not null,
  part_name            VARCHAR2(100),
  part_no              VARCHAR2(100),
  spec_cd              VARCHAR2(100),
  mfa_cd               VARCHAR2(100),
  qty                  VARCHAR2(10),
  unit_price           VARCHAR2(20),
  dept_cd              VARCHAR2(20),
  reg_date             VARCHAR2(10),
  inv_cd               VARCHAR2(20),
  inv_rea_cd           VARCHAR2(20),
  inv_pur_cd           VARCHAR2(20),
  inv_loc_cd           VARCHAR2(20),
  reg_user_id          VARCHAR2(20)
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Add comments to the table 
comment on table INVENTORY_MGMT
  is '재고관리';
-- Add comments to the columns 
comment on column INVENTORY_MGMT.inventory_mgmt_objid
  is 'OBJID';
comment on column INVENTORY_MGMT.project_mgmt_objid
  is 'PROJECT_OBJID';
comment on column INVENTORY_MGMT.part_name
  is '품목명';
comment on column INVENTORY_MGMT.part_no
  is '품번';
comment on column INVENTORY_MGMT.spec_cd
  is '규격';
comment on column INVENTORY_MGMT.mfa_cd
  is '제조사';
comment on column INVENTORY_MGMT.qty
  is '수량';
comment on column INVENTORY_MGMT.unit_price
  is '단가';
comment on column INVENTORY_MGMT.dept_cd
  is '팀명';
comment on column INVENTORY_MGMT.reg_date
  is '등록일';
comment on column INVENTORY_MGMT.inv_cd
  is '재고구분';
comment on column INVENTORY_MGMT.inv_rea_cd
  is '사유';
comment on column INVENTORY_MGMT.inv_pur_cd
  is '구매구분';
comment on column INVENTORY_MGMT.inv_loc_cd
  is '위치';
comment on column INVENTORY_MGMT.reg_user_id
  is '등록';


-- Create table
create table MATERIAL_RELEASE
(
  material_release_objid NUMBER not null,
  inventory_mgmt_objid   NUMBER not null,
  project_mgmt_objid     NUMBER not null,
  rel_qty                VARCHAR2(20),
  rel_pur_cd             VARCHAR2(20),
  rel_date               VARCHAR2(10),
  rel_user_id            VARCHAR2(20),
  reg_date               DATE,
  reg_user_id            VARCHAR2(20)
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Add comments to the table 
comment on table MATERIAL_RELEASE
  is '자재불출';
-- Add comments to the columns 
comment on column MATERIAL_RELEASE.material_release_objid
  is 'OBJID';
comment on column MATERIAL_RELEASE.inventory_mgmt_objid
  is '재고관리OBJID';
comment on column MATERIAL_RELEASE.project_mgmt_objid
  is 'PROJECT_OBJID';
comment on column MATERIAL_RELEASE.rel_qty
  is '불출수량';
comment on column MATERIAL_RELEASE.rel_pur_cd
  is '용도';
comment on column MATERIAL_RELEASE.rel_date
  is '불출일';
comment on column MATERIAL_RELEASE.rel_user_id
  is '인수자';
comment on column MATERIAL_RELEASE.reg_date
  is '등록일';
comment on column MATERIAL_RELEASE.reg_user_id
  is '등록';


-- Create table
create table TIME_SHEET
(
  objid              NUMBER not null,
  project_mgmt_objid NUMBER,
  work_date          VARCHAR2(10),
  reg_user_id        VARCHAR2(20),
  bus_cd             VARCHAR2(100),
  title              VARCHAR2(500),
  trip_cd            VARCHAR2(100),
  company_cd         VARCHAR2(100),
  work_time          VARCHAR2(10),
  reg_date           DATE
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Add comments to the table 
comment on table TIME_SHEET
  is 'Time Sheet 관리';
-- Add comments to the columns 
comment on column TIME_SHEET.objid
  is 'OBJID';
comment on column TIME_SHEET.project_mgmt_objid
  is '프로젝트 OBJID';
comment on column TIME_SHEET.work_date
  is '날짜';
comment on column TIME_SHEET.reg_user_id
  is '등록자';
comment on column TIME_SHEET.bus_cd
  is '업무구분';
comment on column TIME_SHEET.title
  is '상세내용';
comment on column TIME_SHEET.trip_cd
  is '출장지';
comment on column TIME_SHEET.company_cd
  is '업체명';
comment on column TIME_SHEET.work_time
  is '근무시간';
comment on column TIME_SHEET.reg_date
  is '등록';



-- Create table
create table EXPENSE_MASTER
(
  expense_master_objid NUMBER not null,
  project_mgmt_objid   NUMBER not null,
  expense_id           VARCHAR2(20) not null,
  bns_start_date       VARCHAR2(10),
  bns_end_date         VARCHAR2(10),
  exp_status_cd        VARCHAR2(20),
  exp_company_cd       VARCHAR2(20),
  exp_area_cd          VARCHAR2(20),
  vehicel_used         VARCHAR2(100),
  bus_users_id         VARCHAR2(100),
  bus_content          VARCHAR2(1000),
  bus_title            VARCHAR2(1000),
  reason               VARCHAR2(4000),
  instructions         VARCHAR2(4000),
  reg_user_id          VARCHAR2(20),
  reg_date             VARCHAR2(10)
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Add comments to the table 
comment on table EXPENSE_MASTER
  is '경비청구마스터';
-- Add comments to the columns 
comment on column EXPENSE_MASTER.expense_master_objid
  is 'OBJID';
comment on column EXPENSE_MASTER.project_mgmt_objid
  is '프로젝트 OBJID';
comment on column EXPENSE_MASTER.expense_id
  is '신청번호';
comment on column EXPENSE_MASTER.bns_start_date
  is '출장시작일';
comment on column EXPENSE_MASTER.bns_end_date
  is '출장종료일';
comment on column EXPENSE_MASTER.exp_status_cd
  is '단계';
comment on column EXPENSE_MASTER.exp_company_cd
  is '업체';
comment on column EXPENSE_MASTER.exp_area_cd
  is '지역';
comment on column EXPENSE_MASTER.vehicel_used
  is '이용차량';
comment on column EXPENSE_MASTER.bus_users_id
  is '출장자';
comment on column EXPENSE_MASTER.bus_content
  is '출장목적';
comment on column EXPENSE_MASTER.bus_title
  is '제목';
comment on column EXPENSE_MASTER.reason
  is '특이사항';
comment on column EXPENSE_MASTER.instructions
  is '지시사항';
comment on column EXPENSE_MASTER.reg_user_id
  is '작성자';
comment on column EXPENSE_MASTER.reg_date
  is '작성';

-- Create table
create table EXPENSE_DETAIL
(
  expense_detail_objid NUMBER not null,
  expense_master_objid NUMBER not null,
  exp_sort_cd          VARCHAR2(20),
  exp_subm_cd          VARCHAR2(20),
  exp_subd_cd          VARCHAR2(20),
  card_used            VARCHAR2(20),
  cash_used            VARCHAR2(20),
  payment              VARCHAR2(20)
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Add comments to the table 
comment on table EXPENSE_DETAIL
  is '경비청구 DETAIL';
-- Add comments to the columns 
comment on column EXPENSE_DETAIL.expense_detail_objid
  is 'OBJID';
comment on column EXPENSE_DETAIL.expense_master_objid
  is '경비마스터OBJID';
comment on column EXPENSE_DETAIL.exp_sort_cd
  is '구분';
comment on column EXPENSE_DETAIL.exp_subm_cd
  is '계정과목';
comment on column EXPENSE_DETAIL.exp_subd_cd
  is '적요';
comment on column EXPENSE_DETAIL.card_used
  is '카드사용액';
comment on column EXPENSE_DETAIL.cash_used
  is '현금사용액';
comment on column EXPENSE_DETAIL.payment
  is '가지급금액';


-- Create table
create table FACILITY_ASSEMBLY_PLAN
(
  assembly_plan_objid NUMBER not null,
  project_mgmt_objid  NUMBER not null,
  project_no          VARCHAR2(50),
  region_cd           VARCHAR2(15),
  customer_cd         VARCHAR2(15),
  order_title         VARCHAR2(200),
  del_date            VARCHAR2(8),
  production_pm       VARCHAR2(20),
  fir_reg_date        VARCHAR2(8),
  chg_date            VARCHAR2(8),
  chg_cnt             VARCHAR2(10),
  reg_id              VARCHAR2(20),
  reg_date            DATE
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Add comments to the table 
comment on table FACILITY_ASSEMBLY_PLAN
  is '설비조립계획';
-- Add comments to the columns 
comment on column FACILITY_ASSEMBLY_PLAN.assembly_plan_objid
  is '설비조립계획OBJID';
comment on column FACILITY_ASSEMBLY_PLAN.project_mgmt_objid
  is '프로젝트 OBJID';
comment on column FACILITY_ASSEMBLY_PLAN.region_cd
  is '지역';
comment on column FACILITY_ASSEMBLY_PLAN.customer_cd
  is '고객사';
comment on column FACILITY_ASSEMBLY_PLAN.order_title
  is '수주명(프로젝트명)';
comment on column FACILITY_ASSEMBLY_PLAN.del_date
  is '납품일';
comment on column FACILITY_ASSEMBLY_PLAN.production_pm
  is '등록자(엽업 생산SUB-PM)';
comment on column FACILITY_ASSEMBLY_PLAN.fir_reg_date
  is '최초등록일';
comment on column FACILITY_ASSEMBLY_PLAN.chg_date
  is '변경일';
comment on column FACILITY_ASSEMBLY_PLAN.chg_cnt
  is '변경차수';
comment on column FACILITY_ASSEMBLY_PLAN.reg_id
  is '등록자';
comment on column FACILITY_ASSEMBLY_PLAN.reg_date
  is '등록일';
-- Create/Recreate primary, unique and foreign key constraints 
alter table FACILITY_ASSEMBLY_PLAN
  add constraint ASSEMBLY_PLAN_PK primary key (ASSEMBLY_PLAN_OBJID)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );



-- Create table
create table HUMAN_INPUT_PLAN
(
  input_date          VARCHAR2(8) not null,
  assembly_plan_objid NUMBER not null,
  plan_in_count       VARCHAR2(8),
  plan_out_count      VARCHAR2(8),
  per_in_count        VARCHAR2(8),
  per_out_count       VARCHAR2(8),
  reg_id              VARCHAR2(20),
  reg_date            DATE
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Add comments to the table 
comment on table HUMAN_INPUT_PLAN
  is '투입인원_계획_실적';
-- Add comments to the columns 
comment on column HUMAN_INPUT_PLAN.input_date
  is '입력일';
comment on column HUMAN_INPUT_PLAN.assembly_plan_objid
  is '설비조립계획 OBJID';
comment on column HUMAN_INPUT_PLAN.plan_in_count
  is '계획(자사) 투입인원';
comment on column HUMAN_INPUT_PLAN.plan_out_count
  is '계획(외주) 투입인원';
comment on column HUMAN_INPUT_PLAN.per_in_count
  is '실적(자사) 투입인원';
comment on column HUMAN_INPUT_PLAN.per_out_count
  is '실적(외주) 투입인원';
comment on column HUMAN_INPUT_PLAN.reg_id
  is '등록자';
comment on column HUMAN_INPUT_PLAN.reg_date
  is '동륵';
-- Create/Recreate primary, unique and foreign key constraints 
alter table HUMAN_INPUT_PLAN
  add constraint HUMAN_INPUT_PLAN_PK primary key (INPUT_DATE, ASSEMBLY_PLAN_OBJID)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );




